home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / game / board / Exchess.lha / EXChess / score.h < prev    next >
C/C++ Source or Header  |  1998-08-22  |  13KB  |  438 lines

  1. /* Header for scoring alogrithm */
  2.  
  3. int BAD_BISHOP =          6;
  4. int DOUBLED_PAWN =        8;
  5. int WEAK_PAWN =           5;
  6. int BACKWARD_PAWN =       7;
  7. int PAWN_ISLAND =         8;
  8. int PASSED_PAWN =        10;
  9. int PAWN_SHIELD =         7;
  10. int BISHOP_PAIR =        15;
  11. int ROOK_CONN =          10;
  12. int CON_PASSED_PAWNS =  400;
  13. int FILE_BONUS =         10;
  14. int HALF_FILE_BONUS =     5;
  15. int HAS_CASTLED =        15;
  16. int ROOK_KING_FILE =      2;
  17. int TRADE_PIECES =        2;
  18. int KEEP_PAWNS =          2;
  19.  
  20. // values for having pieces near the king, changes with stage
  21. char king_proximity[4][7][8] = {
  22. { { 0, 0, 0, 0, 0, 0, 0, 0 },
  23.   { 0,35,25,10, 5, 0, 0, 0 },
  24.   { 0, 5, 9, 9, 5, 0, 0, 0 },
  25.   { 0, 7, 5, 3, 3, 0, 0, 0 },
  26.   { 0, 7, 5, 3, 3, 0, 0, 0 },
  27.   { 0,15,12, 7, 5, 3, 0, 0 },
  28.   { 0, 0, 0, 0, 0, 0, 0, 0 } },
  29.  
  30. { { 0, 0, 0, 0, 0, 0, 0, 0 },
  31.   { 0,35,25,10, 5, 0, 0, 0 },
  32.   { 0, 5, 9, 9, 5, 0, 0, 0 },
  33.   { 0, 7, 5, 3, 3, 0, 0, 0 },
  34.   { 0, 7, 5, 3, 3, 0, 0, 0 },
  35.   { 0,15,12, 7, 5, 3, 0, 0 },
  36.   { 0, 0, 0, 0, 0, 0, 0, 0 } },
  37.  
  38. { { 0, 0, 0, 0, 0, 0, 0, 0 },
  39.   { 0, 0, 0, 0, 0, 0, 0, 0 },
  40.   { 0, 5, 9, 9, 5, 0, 0, 0 },
  41.   { 0, 7, 5, 3, 3, 0, 0, 0 },
  42.   { 0, 7, 5, 3, 3, 0, 0, 0 },
  43.   { 0,15,12, 7, 5, 3, 0, 0 },
  44.   { 0, 0, 0, 0, 0, 0, 0, 0 } },
  45.  
  46. { { 0, 0, 0, 0, 0, 0, 0, 0 },
  47.   { 0,-5,-3, 0, 2, 4, 7, 9 },
  48.   { 0, 5, 9, 9, 5, 0, 0, 0 },
  49.   { 0, 7, 5, 3, 3, 0, 0, 0 },
  50.   { 0, 7, 5, 3, 3, 0, 0, 0 },
  51.   { 0,15,12, 7, 5, 3, 0, 0 },
  52.   { 0, 0, 0, 0, 0, 0, 0, 0 } } };
  53.  
  54. // Value of the pieces
  55. int value[7] = { 0, 100, 330, 330, 550, 1000, 10000 };
  56.  
  57. // Lazy eval cutoff during search
  58. int lazy[4] = { 150, 300, 600, 1000 };
  59.  
  60. // external search parameters
  61. /* extensions */
  62. extern int THRESHOLD, CAPT_EXT, CHECK_EXT, PAWN_EXT, RE_CAPT_EXT;
  63. extern int INIT_EXT, MATE_EXT, PV_EXT, R, RAZOR_DEPTH;
  64.  
  65. // Piece square tables
  66. short piece_sq[2][7][64];
  67.  
  68. // proto-types for piece square tables, first index is for the stage of
  69. // the game, 2nd index is for piece
  70. // stage 0 = opening
  71. // stage 1 = early middle-game
  72. // stage 2 = late middle-game
  73. // stage 3 = ending
  74.  
  75. short proto_piece_sq[4][7][64] = {
  76.  
  77.  
  78. // Reading these is a little tricky.  These tables
  79. // are set up to look like a chess board from white's
  80. // point of view, but they are indexed from black's
  81. // point of view.  The whitef array is used to
  82. // map these values to the right squares for white.
  83.  
  84. /*----------------------  Opening ------------------------*/
  85. // For no piece ...
  86. { {
  87.         0,  0,  0,  0,  0,  0,  0,  0,
  88.         0,  0,  0,  0,  0,  0,  0,  0,
  89.         0,  0,  0,  0,  0,  0,  0,  0,
  90.         0,  0,  0,  0,  0,  0,  0,  0,
  91.         0,  0,  0,  0,  0,  0,  0,  0,
  92.         0,  0,  0,  0,  0,  0,  0,  0,
  93.         0,  0,  0,  0,  0,  0,  0,  0,
  94.         0,  0,  0,  0,  0,  0,  0,  0
  95. },
  96.  
  97. // For the pawn
  98. {
  99.         0,  0,  0,  0,  0,  0,  0,  0,
  100.         0,  0,  0,  0,  0,  0,  0,  0,
  101.         0,  0,  0,  0,  0,  0,  0,  0,
  102.         0,  0,  0,  0,  0,  0,  0,  0,
  103.         0,  0,  0, 25, 25,-15,-15,-15,
  104.         0,  0,  0, 10, 10,-10,-10,-10,
  105.         0,  0,  0,-10,-10,  0,  0,  0,
  106.         0,  0,  0,  0,  0,  0,  0,  0
  107. },
  108.  
  109. // For knight proto_piece_sq[KNIGHT]
  110. {
  111.        -8, -6, -4, -4, -4, -4, -6, -8,
  112.        -6,  0,  0,  0,  0,  0,  0, -6,
  113.        -4,  7,  8,  8,  8,  8,  7, -4,
  114.        -4,  7,  7,  8,  8,  7,  7, -4,
  115.        -4,  6,  7,  8,  8,  7,  6, -4,
  116.        -4,  5,  8,  6,  6,  8,  5, -4,
  117.        -6,  0,  0,  5,  5,  0,  0, -6,
  118.        -8,-10, -4, -4, -4, -4,-10, -8
  119. },
  120.  
  121. // For bishop proto_piece_sq[BISHOP] =
  122. {
  123.         0,  0,  0,  0,  0,  0,  0,  0,
  124.       -15,  0,  0,  0,  0,  0,  0,-15,
  125.         0,  0,  7,  8,  8,  7,  0,  0,
  126.         0,  7,  7,  8,  8,  7,  7,  0,
  127.         0,  7,  7,  8,  8,  7,  7,  0,
  128.         0,  0,  0, -5, -5,  0,  0,  0,
  129.         0,  5,  0,  0,  0,  0,  5,  0,
  130.         0,  0,-10,  0,  0,-10,  0,  0
  131. },
  132.  
  133. // For rook proto_piece_sq[ROOK] =
  134. {
  135.         0,  0,  0,  0,  0,  0,  0,  0,
  136.         0,  0,  0,  0,  0,  0,  0,  0,
  137.         0,  0,  0,  0,  0,  0,  0,  0,
  138.         0,  0,  0,  0,  0,  0,  0,  0,
  139.         0,  0,  0,  0,  0,  0,  0,  0,
  140.         0,  0,  0,  0,  0,  0,  0,  0,
  141.         0,  0,  0,  0,  0,  0,  0,  0,
  142.         0,  0,  0,  5,  5,  0,  0,  0
  143. },
  144.  
  145. // For queen proto_piece_sq[QUEEN] =
  146. {
  147.         0,  0,  0,  0,  0,  0,  0,  0,
  148.         0,  0,  0,  0,  0,  0,  0,  0,
  149.         0,  0,  0,  0,  0,  0,  0,  0,
  150.         0,  0,  0,  0,  0,  0,  0,  0,
  151.         0,  0,  0,  0,  0,  0,  0,  0,
  152.         0,  0,  0,  0,  0,  0,  0,  0,
  153.         0,  0,  3,  3,  3,  0,  0,  0,
  154.         0,  0,  0,  3,  0,  0,  0,  0
  155. },
  156.  
  157. // For king proto_piece_sq[KING] =
  158. {
  159.       -25,-25,-25,-25,-25,-25,-25,-25,
  160.       -25,-25,-25,-25,-25,-25,-25,-25,
  161.       -25,-25,-25,-25,-25,-25,-25,-25,
  162.       -25,-25,-25,-25,-25,-25,-25,-25,
  163.       -25,-25,-25,-25,-25,-25,-25,-25,
  164.       -25,-25,-25,-25,-25,-25,-25,-25,
  165.        -5, -5,-25,-25,-25,-25, -5, -5,
  166.        10, 10, 10,-15,  0,-15, 10, 10
  167. } },
  168.  
  169. /*---------------------- Early Middle Game ------------------------*/
  170. // For no piece ...
  171. { {
  172.         0,  0,  0,  0,  0,  0,  0,  0,
  173.         0,  0,  0,  0,  0,  0,  0,  0,
  174.         0,  0,  0,  0,  0,  0,  0,  0,
  175.         0,  0,  0,  0,  0,  0,  0,  0,
  176.         0,  0,  0,  0,  0,  0,  0,  0,
  177.         0,  0,  0,  0,  0,  0,  0,  0,
  178.         0,  0,  0,  0,  0,  0,  0,  0,
  179.         0,  0,  0,  0,  0,  0,  0,  0
  180. },
  181.  
  182. // For the pawn
  183. {
  184.         0,  0,  0,  0,  0,  0,  0,  0,
  185.         0,  0,  0,  0,  0,  0,  0,  0,
  186.         0,  0,  0,  0,  0,  0,  0,  0,
  187.         0,  0,  0, 25, 25,  0,  0,  0,
  188.         0,  0,  0, 25, 25,-15,-15,-15,
  189.         0,  0,  0, 10, 10,-15, -5, -5,
  190.         0,  0,  0,-10,-10,  0,  0,  0,
  191.         0,  0,  0,  0,  0,  0,  0,  0
  192. },
  193.  
  194. // For knight proto_piece_sq[KNIGHT] =
  195. {
  196.       -10, -7, -5, -5, -5, -5, -5,-10,
  197.        -7,  2,  4,  4,  4,  4,  2, -7,
  198.        -5,  7,  8,  8,  8,  8,  7, -5,
  199.        -5,  7,  7,  8,  8,  7,  7, -5,
  200.        -5,  6,  7,  8,  8,  7,  6, -5,
  201.        -5,  3,  8,  6,  6,  8,  3, -5,
  202.        -7,  0,  3,  5,  5,  3,  0, -7,
  203.       -10,-10, -5, -5, -5, -5,-10,-10
  204. },
  205.  
  206. // For bishop proto_piece_sq[BISHOP] =
  207. {
  208.         0,  0,  0,  0,  0,  0,  0,  0,
  209.       -15,  0,  0,  0,  0,  0,  0,-15,
  210.         0,  0,  7,  8,  8,  7,  0,  0,
  211.         0,  7,  7,  8,  8,  7,  7,  0,
  212.         0,  7,  7,  8,  8,  7,  7,  0,
  213.         0,  0,  0, -5, -5,  0,  0,  0,
  214.         0,  5,  0,  0,  0,  0,  5,  0,
  215.         0,  0,-10,  0,  0,-10,  0,  0
  216. },
  217.  
  218. // For rook proto_piece_sq[ROOK] =
  219. {
  220.         0,  0,  0,  0,  0,  0,  0,  0,
  221.        10, 10, 10, 10, 10, 10, 10, 10,
  222.         0,  0,  0,  0,  0,  0,  0,  0,
  223.         0,  0,  0,  0,  0,  0,  0,  0,
  224.         0,  0,  0,  0,  0,  0,  0,  0,
  225.         0,  0,  0,  0,  0,  0,  0,  0,
  226.         0,  0,  0,  0,  0,  0,  0,  0,
  227.         0,  0,  0,  5,  5,  0,  0,  0
  228. },
  229.  
  230. // For queen proto_piece_sq[QUEEN] =
  231. {
  232.         0,  0,  0,  0,  0,  0,  0,  0,
  233.         0,  0,  0,  0,  0,  0,  0,  0,
  234.         0,  0,  0,  0,  0,  0,  0,  0,
  235.         0,  0,  0,  0,  0,  0,  0,  0,
  236.         0,  0,  0,  0,  0,  0,  0,  0,
  237.         0,  0,  0,  0,  0,  0,  0,  0,
  238.         0,  0,  3,  3,  3,  0,  0,  0,
  239.         0,  0,  0,  0,  0,  0,  0,  0
  240. },
  241.  
  242. // For king proto_piece_sq[KING] =
  243. {
  244.       -25,-25,-25,-25,-25,-25,-25,-25,
  245.       -25,-25,-25,-25,-25,-25,-25,-25,
  246.       -25,-25,-25,-25,-25,-25,-25,-25,
  247.       -25,-25,-25,-25,-25,-25,-25,-25,
  248.       -25,-25,-25,-25,-25,-25,-25,-25,
  249.       -25,-25,-25,-25,-25,-25,-25,-25,
  250.        -5, -5,-25,-25,-25,-25, -5, -5,
  251.        10, 10, 10,-15,  0,-15, 10, 10
  252. } },
  253.  
  254. /*---------------------- Late Middle Game ------------------------*/
  255. // For no piece ...
  256. { {
  257.         0,  0,  0,  0,  0,  0,  0,  0,
  258.         0,  0,  0,  0,  0,  0,  0,  0,
  259.         0,  0,  0,  0,  0,  0,  0,  0,
  260.         0,  0,  0,  0,  0,  0,  0,  0,
  261.         0,  0,  0,  0,  0,  0,  0,  0,
  262.         0,  0,  0,  0,  0,  0,  0,  0,
  263.         0,  0,  0,  0,  0,  0,  0,  0,
  264.         0,  0,  0,  0,  0,  0,  0,  0
  265. },
  266.  
  267. // For the pawn
  268. {
  269.         0,  0,  0,  0,  0,  0,  0,  0,
  270.       100,100,100,100,100,100,100,100,
  271.        20, 20, 20, 25, 25, 20, 20, 25,
  272.        10, 10, 10, 15, 15, 10, 10,